import { useEffect, useState } from 'react';
import { Form, Row, Col, Select, Button, Space } from 'antd';
// import { getProductRelatedApi } from "apis/serviceApi";
// import { ServicerSercherProps } from "types/servicer.type";
export interface PageInfoProps {
  pageIndex: number;
  pageSize: number;
}
const { Option } = Select;

export const PublicPageSearchForm = ({ setParam, pageInfo, setPageInfo, getPageList }: any) => {
  useEffect(() => {
    //   一进页面现请求下拉选项的下拉list
    // getServiceAssociationListF();
    return () => {};
  }, []);
  //模拟ajax
  const testajax = (res: any) => {
    return new Promise((resolve) => {
      resolve(res);
    });
  };

  const [form] = Form.useForm();
  //服务关联维度下拉array
  const [serviceAssociationList, setserviceAssociationList] = useState<any[]>([
    { code: 1, value: '第一项' },
    { code: 2, value: '第二项' },
    { code: 3, value: '第三项' },
  ]);
  const onFinish = (values: any) => {
    console.log(values);
    // console.log(values, finallySelectId);
    // setParam({ ...values, filterId: finallySelectId });
    // setPageInfo({ ...pageInfo, pageIndex: 1 });
    // setJustNumber(Math.random());
  };

  return (
    <Form
      className="anTopSearchForm"
      form={form}
      layout="inline"
      name="maitainSearcher"
      onFinish={onFinish}
    >
      <Col span={24}>
        <Form.Item
          label="服务关联维度2"
          name="serviceAssociationDimension"
          style={{ marginBottom: '1rem' }}
        >
          <Select
            showSearch
            style={{ width: 220 }}
            placeholder="请选择"
            optionFilterProp="children"
          >
            {serviceAssociationList.map((item) => {
              return (
                <Option key={item.code} value={item.code}>
                  {item.name}
                </Option>
              );
            })}
          </Select>
        </Form.Item>
      </Col>
      <Col className="searchBtnBox" span={24}>
        <Space size={'middle'}>
          <Form.Item>
            <Button>重置</Button>
            <Button className="marg020" type={'primary'} htmlType="submit">
              搜索
            </Button>
          </Form.Item>
        </Space>
      </Col>
    </Form>
  );
};
